﻿@using PTop.Code
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<link href="~/Content/js/simditor/css/simditor.css" rel="stylesheet" />
<script src="~/Content/js/simditor/js/module.min.js"></script>
<script src="~/Content/js/simditor/js/hotkeys.min.js"></script>
<script src="~/Content/js/simditor/js/simditor.min.js"></script>
<script src="~/Content/js/uploadImage/jquery.ui.widget.min.js"></script>
<script src="~/Content/js/uploadImage/jquery.iframe-transport.min.js"></script>
<script src="~/Content/js/uploadImage/jquery.fileupload.min.js"></script>
<link href="~/Content/js/uploadImage/jquery.fileupload-image.css" rel="stylesheet" />
<script src="~/Content/js/uploadImage/jquery.fileupload-image-extend.js"></script>
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        initControl();
        $.ajax({
            url: "/Article/Article/GetFormJson",
            data: { keyValue: keyValue },
            dataType: "json",
            async: false,
            success: function (data) {
                $("#form1").formSerialize(data);

                $("#F_Link").val("@Configs.GetValue("WapHost")/Article/Article/Detail?keyValue=" + data.F_Id + "#/");

                //富文本编辑
                var editor = new Simditor({
                    textarea: $('#F_Content'),
                    toolbar: ['title']
                });
                editor.setValue(data.F_Content);

                //$("#form1").find('.form-control,select,input').attr('readonly', 'readonly');
                $("#form1").find('div.ckbox label').attr('for', '');

                $("#F_TitleImage").bindUpload({
                    limitCount: 1,
                    type: "ArticleTitle",
                    readonly: true
                });
            }
        });
    });
    function initControl() {
        $("#F_Type").bindSelect({
            url: "/Article/Article/GetArticleTypes",
        });

        $.ajax({
            url: "/Article/Article/GetTagJson",
            data: { keyValue: keyValue },
            dataType: "json",
            async: false,
            success: function (data) {
                var tags = "";
                for (var i = 0; i < data.length; i++) {
                    tags += data[i].F_Name + ", ";
                }
                if (tags.length > 0) {
                    tags = tags.substring(0, tags.length - 2);
                }
                $("#F_TagNames").val(tags);
                $("#F_TagNames").attr('readonly', 'readonly');
            }
        });
    }
</script>

<form id="form1">
    <div style="padding-top: 20px; margin-right: 20px;">
        <table class="form">
            <tr>
                <th class="formTitle">前台链接</th>
                <td class="formValue">
                    <input id="F_Link" name="F_Link" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">文章类别</th>
                <td class="formValue">
                    <select id="F_Type" name="F_Type" class="form-control required">
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">标题</th>
                <td class="formValue">
                    <input id="F_Title" name="F_Title" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">标题图片</th>
                <td class="formValue">
                    <input id="F_TitleImage" name="F_TitleImage" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">内容</th>
                <td class="formValue">
                    <textarea id="F_Content" name="F_Content" class="form-control" rows="5"></textarea>
                </td>
            </tr>
            <tr>
                <th class="formTitle">是否置顶</th>
                <td class="formValue">
                    <select id="F_IsTop" name="F_IsTop" class="form-control required">
                        <option value="false">否</option>
                        <option value="true">是</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">可否评论</th>
                <td class="formValue">
                    <select id="F_CanComment" name="F_CanComment" class="form-control required">
                        <option value="false">否</option>
                        <option value="true">是</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">点击量</th>
                <td class="formValue">
                    <input id="F_ClickNumber" name="F_ClickNumber" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">评论量</th>
                <td class="formValue">
                    <input id="F_CommentNumber" name="F_CommentNumber" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">答题量</th>
                <td class="formValue">
                    <input id="F_AnswerNumber" name="F_AnswerNumber" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">标签</th>
                <td class="formValue">
                    <input id="F_TagNames" type="text" class="form-control required" placeholder="" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">发布状态</th>
                <td class="formValue">
                    <select id="F_State" name="F_State" class="form-control required">
                        <option value="0">未发布</option>
                        <option value="1">已发布</option>
                        <option value="2">失效</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">创建人员</th>
                <td class="formValue">
                    <input id="F_CreatorUserId" name="F_CreatorUserId" type="text" class="form-control" />
                </td>
            </tr>
            <tr>

                <th class="formTitle">创建时间</th>
                <td class="formValue">
                    <input id="F_CreatorTime" name="F_CreatorTime" type="text" class="form-control" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">修改人员</th>
                <td class="formValue">
                    <input id="F_LastModifyUserId" name="F_LastModifyUserId" type="text" class="form-control" />
                </td>

            </tr>
            <tr>
                <th class="formTitle">修改时间</th>
                <td class="formValue">
                    <input id="F_LastModifyTime" name="F_LastModifyTime" type="text" class="form-control" />
                </td>
            </tr>
        </table>
    </div>
</form>
